CC = clang

all: demo_bpf demo vm_h

demo_bpf:
	${CC} -Wall -c -O2 demo_bpf.c -target bpf -o $@.bpf

demo: bpf_load.o demo.o
	${CC} -g $^ -l elf -l bpf -o $@

clean:
	rm -f *.o demo demo_bpf.bpf

vm_h:
	bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h

bpf_load.o : bpf_load.c

demo.o : demo.c

%.o: %.c
	${CC} -Wall -c -g $< -o $@
